<template>
  <div class="text-center success_page">
    <span class="green-font"><i style="font-size:88px" class="el-icon-circle-check" /></span>
    <h2 class="green-font">恭喜您！编辑商品成功</h2>
    <p class="color-999">商品编号：{{ goodsId }}</p>
    <p class="btns">
      <el-button class="blue_border" @click="$router.push(routeParam)">{{ btnText }}</el-button>
    </p>
  </div>
</template>

<script>
export default {
  // props: ['goodsId'],
  props: {
    goodsId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      routeParam: {
        name: 'goodsList'
      },
      btnText: '查看商品列表'
    }
  },
  beforeRouteEnter(to, from, next) {
    if (from.name === 'goodsMealEdit') {
      next(vm => {
        vm.routeParam = {
          name: 'goodsMealInfo',
          params: {
            goodsId: vm.goodsId
          }
        }
        vm.btnText = '返回套餐列表'
      })
    } else {
      next()
    }
  }
}
</script>

<style lang="scss" scoped>
.success_page {
  padding: 50px 0;
  line-height: 35px;

  .btns {
    margin-top: 20px;
  }
}
</style>
